<template>
	<div class="bgBox" v-if='contentList.length'>
		<a class='block_a ' :href="Path+activeContent?.url" target="_blank">
		    <img class="bg" :src="getImgPath((activeContent.extend.singleImgUploadYla8?activeContent.extend.singleImgUploadYla8:'') ||  activeContent.headImag || '')" alt="" srcset="">
		</a>
		<div class="bgtitle ">
			<p v-for="(item,index) in contentList" class="title flowHidden" @mouseover="activeTitle(index)">{{item.title}}</p>
		</div>
	</div>
</template>

<script>
	  export default {
	    data() {
	      return {
	        drawer: false,
					contentList: [],
					Path: getRootPath(),
					activeContent:{},
					query: GetQueryString(),
	      };
	    },
			mounted(){
				this.getContentOfChannel();
			},
			methods:{
				inintSlide() {
					var swiper = new Swiper('.swiper-container', {
						pagination: {
						        el: ".swiper-pagination",
						        clickable: true,
						      },
						paginationClickable: true,
						navigation: {
						    nextEl: ".icon-a-Rightarrow",
						    prevEl: ".icon-a-Leftarrow",
						},
						parallax: true,
						speed: 3000,
						loop: true,
						autoplay: true
					});
					$('.swiper-container').mouseover(function() {
						swiper.autoplay.stop();
						// 停止自动滚动
					});
					$('.swiper-container').mouseout(function() {
						swiper.autoplay.start();
					});
				},
				activeTitle(index){
					this.activeContent = this.contentList[index];
					console.log(this.activeContent,this.contentList, this.contentList[index], 'this.activeContent');
				},
				getContentOfChannel() {
					let param = {
						pageNum: 1,
						pageSize: 5,
						channelIdStr: this.query.id,
						typeIdStr: '1002',
					};
					contentApi.fetchContentOfChannel(param, res => {
						if (res.code == '00000 00000') {
							this.contentList = res.data.records;
							this.activeContent = res.data.records[0];
							this.$nextTick(()=>{
								//this.inintSlide();
							})
						} else {
						}
					});
				},
				getImgPath(url){
					return imgPath(url);
				},
			}
	  };
</script>

<style scoped="scoped">
.bgBox {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
  height: fit-content;
  overflow: hidden;
}
.bgBox .block_a {
  width: 100%;
}
.bgBox .bg {
  width: 100%;
  min-width: 1280px;
  max-width: 2560px;
  height: auto;
}
.bgBox .bgtitle {
  width: 18%;
  height: 100%;
  position: absolute;
  right: 12.5%;
  background: rgba(0,0,0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: auto;
}
.bgBox .bgtitle .title {
  margin-top: 48px;
  padding: 0 32px;
  font-size: 20px;
  font-weight: 400;
  color: #FFFFFF;
  width: 100%;
  opacity: 0.6;
	box-sizing: border-box;
}
.bgBox .bgtitle .title:hover {
  opacity: 1;
}
.bgBox .bgtitle .title:first-child {
  margin-top: 0;
}
@media (max-width: 1440px) {
  .bgBox .bgtitle .title {
    font-size: 14px;
  }
}
@media (min-width: 1441px) and (max-width: 1600px) {
  .bgBox .bgtitle .title {
    font-size: 16px;
  }
}
@media (min-width: 1601px) and (max-width: 1920px) {
  .bgBox .bgtitle .title {
    font-size: 20px;
  }
}
@media (min-width: 1921px) {
  .bgBox .bgtitle .title {
    font-size: 22px;
  }
}


</style>